#这个代码是用于爬虫打开多个页面

from selenium import webdriver

import time

exepath=r'E:\programlibs\chromedriver\chromedriver.exe'

driver=webdriver.Chrome(executable_path=exepath)

driver.get('https://www.baidu.com')

driver.execute_script("window.open('https://www.douban.com/')")

time.sleep(5)

driver.switch_to.window(driver.window_handles[0])

print(driver.current_url)